﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AteneoLibriBusinessLogic.Entities;

namespace AteneoLibri
{
    public partial class rss : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            using (wsAteneoLibri.AteneoLibriServiceClient service = new wsAteneoLibri.AteneoLibriServiceClient())
            {
                List<Book> books = service.getBooks();
                RepeaterRSS.DataSource = books.OrderByDescending(x => x.InsertDate).Take(30);
                RepeaterRSS.DataBind();
            }
        }

        protected string RemoveIllegalCharacters(object input)
        {
            // cast the input to a string  
            string data = input.ToString();

            // replace illegal characters in XML documents with their entity references  
            data = data.Replace("&", "&amp;");
            data = data.Replace("\"", "&quot;");
            data = data.Replace("'", "&apos;");
            data = data.Replace("<", "&lt;");
            data = data.Replace(">", "&gt;");

            return data;
        } 
    }
}